package com.tangzx.builder.abc;

import com.tangzx.builder.abc.string.AbcString;

public class Metadata extends AbcElement {
	public int name;
	public int[] keys;
	public int[] values;
	
	public Metadata(int name, int[] keys, int[] values) {
		this.name = name;
		this.keys = keys;
		this.values = values;
	}
	
	@Override
	public String toString() {
		AbcString as = cpool.getString(name);
		return as.toString();
	}
	
	public String getName() {
		return cpool.getString(name).toString();
	}
	
	public void setCanNotMix() {
		AbcString as = cpool.getString(name);
		as.vo.setCanNotMix();
	}
	
	public AbcString getValue(String key) {
		for (int index = 0; index < keys.length; index++) {
			AbcString s = cpool.getString(keys[index]);
			if (s.vo.getValue().equals(key)) {
				AbcString v = cpool.getString(values[index]);
				return v;
			}
		}
		return null;
	}
}
